package com.huabo.system.service.impl;

import com.huabo.system.config.DateBaseConfig;
import com.huabo.system.mysql.entity.TblBiCkEchartsMySql;
import com.huabo.system.mysql.mapper.TblBiCkEchartsMySqlDao;
import com.huabo.system.mysql.mapper.TblBiReportMenuMySqlMapper;
import com.huabo.system.oracle.entity.TblBiCkEcharts;
import com.huabo.system.oracle.mapper.TblBiCkEchartsDao;
import com.huabo.system.oracle.mapper.TblBiReportMenuMapper;
import com.huabo.system.service.TblBiCkEchartsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

@Service
public class TblBiCkEchartsServiceImpl implements TblBiCkEchartsService {

    @Resource
    private TblBiReportMenuMapper tblBiReportMenuMapper;

    @Resource
    private TblBiCkEchartsDao tblBiCkEchartsDao;


    @Resource
    private TblBiReportMenuMySqlMapper tblBiReportMenuMySqlMapper;

    @Resource
    private TblBiCkEchartsMySqlDao tblBiCkEchartsMySqlDao;

//    @Override
//    public List find(BigDecimal pageid) {
//        TblBiReportMenu page = (TblBiReportMenu)tblBiReportMenuMapper.get(pageid);
//        return (List)(page != null ? this.tblBiCkEchartsDao.tblBiCkEchartsDao("tblBiReportMenu", page) : new ArrayList());
//    }

    @Override
    public void delete(BigDecimal pageid) {


        if (DateBaseConfig.DATABASETYPE.equals("Oracle")) {

            tblBiCkEchartsDao.deletePageId(pageid);

        } else {
            tblBiCkEchartsMySqlDao.deletePageId(pageid);
        }

    }

    @Override
    public List<TblBiCkEcharts> getChartsPages(String pageid) {
        return this.tblBiCkEchartsDao.listBySql(pageid);
    }

    @Override
    public List<TblBiCkEchartsMySql> getMySqlChartsPages(String pageid) {
        return this.tblBiCkEchartsMySqlDao.listBySql(pageid);
    }
}
